package observer;

import com.sun.source.doctree.SerialTree;

public class Cat extends MySubject {
    public void notifyObservers() {
        System.out.println("猫叫！");
        System.out.println("----------------------------");

        for (MyObserver obs : observers) {
            if (obs != null) {
                try {
                    obs.response();
                } catch (Exception e) {
                    System.err.println("观察者响应失败: " + e.getMessage());
                }
            }
        }

    }
}